<script language="JavaScript" type="text/javascript">
  <!--
  var gross_profit=100000
  var net_profit
  var profit_sharing_percent=0.1
  var profit_sharing=gross_profit*profit_sharing_percent

  calculate_profit_sharing(profit_sharing)
  
  function calculate_profit_sharing(guess)
  {
    net_profit=gross_profit - guess
    profit_sharing=Math.ceil(net_profit*profit_sharing_percent)
    if((net_profit+profit_sharing)!=gross_profit)
    {
      calculate_profit_sharing(profit_sharing)
    }
  }

  alert("Gross Profit\t"+gross_profit+"\nNet Profit \t"+net_profit+"\nProfit Sharing\t"+profit_sharing)
  //-->
</script>
